package com.lucy.flow.converter;

import com.lucy.common.utils.JsonUtil;
import com.lucy.flow.domain.dto.StrategyParam;

import javax.persistence.AttributeConverter;
import javax.persistence.Converter;

/**
 * 策略参数转化器
 */
@Converter
public class StrategyParamConverter implements AttributeConverter<StrategyParam,String> {
    @Override
    public String convertToDatabaseColumn(StrategyParam strategyParam) {
        return JsonUtil.obj2String(strategyParam);
    }

    @Override
    public StrategyParam convertToEntityAttribute(String s) {
        return JsonUtil.string2Obj(s,StrategyParam.class);
    }
}
